Skip to content

Add STM32 ring buffer driver#79

Merged
wilsonchenghy merged 3 commits into
mainfrom
Ring-Buffer
Jul 8, 2026
Merged

Add STM32 ring buffer driver#79
wilsonchenghy merged 3 commits into
mainfrom
Ring-Buffer

Conversation

@rudrashukla7

Copy link
Copy Markdown
Contributor

Implements a lightweight ring buffer driver for the STM32 embedded system.

Files Added

  • ring_buffer.h - struct definition and public API declarations
  • ring_buffer.c - implementation of init, read, write, and empty functions

Implementation Details
Uses a fixed-size circular byte buffer with configurable size via RING_BUF_SIZE (128 bytes default)
Empty/full distinction handled by sacrificing one slot, giving an effective capacity of size - 1 bytes
ring_buffer_full is kept as a static internal helper, not exposed in the public API
All index arithmetic uses modulo wrapping to keep indices within bounds
Read and write operations return bool to indicate success or failure (empty/full guard)

@wilsonchenghy

Copy link
Copy Markdown
Collaborator

@copilot double check everything is good

@wilsonchenghy

Copy link
Copy Markdown
Collaborator

@copilot double check everything is good

@wilsonchenghy wilsonchenghy merged commit 458e214 into main Jul 8, 2026
2 of 4 checks passed
@wilsonchenghy wilsonchenghy deleted the Ring-Buffer branch July 8, 2026 02:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants